package com.muxue.module.ai.controller;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.ollama.api.OllamaApi;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import static com.muxue.common.exception.ServiceException.exception;
import static com.muxue.module.ai.model.enums.ErrorCodeConstants.CHAT_CONVERSATION_NOT_EXISTS;

@Slf4j
@Tag(name = "AI 核心接口")
@Validated
@RestController
@RequestMapping("/ai/chat/message")
@RequiredArgsConstructor
public class AIController {



    @Operation(summary = "通用对话接口")
    @PostMapping("/send")
    @ResponseStatus(HttpStatus.OK)
    public Mono<ResponseEntity<ChatResponse>> sendMessage(@RequestBody OllamaApi.ChatRequest request, HttpServletRequest httpRequest) {
        throw exception(CHAT_CONVERSATION_NOT_EXISTS);
    }

}